<template>
	
	<view class="list">
		<view class="flex " @click="natTo('/pages/index/userInfo/updatelogin')">
			<view>修改密码</view>
			<uni-icons type="right" color="#dedede" size="16"></uni-icons>
		</view>
		<view class="flex"  @click="natTo('/pages/index/updatepaypassword')">
			<view>设置支付密码</view>
			<uni-icons type="right" color="#dedede" size="16"></uni-icons>
		</view>
		<view class="flex"  @click="natTo('/pages/index/userInfo/bankcard')">
			<view>添加银行卡</view>
			<uni-icons type="right" color="#dedede" size="16"></uni-icons>
		</view>
		
	</view>
	<view v-if="tokenShow==true">
		<!-- <view class="switch"   @click="natTo('/pages/index/userInfo/switch')" >切换账号</view> -->
		<view class="switch2"  @click="delteFn">退出登录</view>
	</view>
	
</template>

<script setup>
	import { computed ,ref,reactive,toRefs,onMounted} from 'vue';
	import { onLoad,onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
	import sheep from '@/sheep';
	
	 const tokenShow=ref(false)
	onShow(()=>{
		  if(uni.getStorageSync('token') ){
			   tokenShow.value=true
			  
		  }else{
			    tokenShow.value=false
		  }
		  
	})
	
	const natTo=(url)=>{
		uni.navigateTo({
			url:url
		})
	}
	
	const delteFn=()=>{
			  console.log('delete');
			  uni.removeStorageSync('token')
			  sheep.$store('user').logout()
			  uni.reLaunch({
			  	url:"/pages/index/newuser"
			  })
	}
</script>

<style  lang="scss" scoped>
	page{ 
		padding:20rpx ;
		
	}
	.list{
		padding:20rpx;
		background-color: #FFF;
		font-size: 28rpx;
	}
	.flex{
		display: flex;
		justify-content: space-between;
		align-items: center;
		border-bottom: 2rpx solid  #eee;
		padding: 18rpx 0;
	}
	.switch{
		text-align: center;
		padding:24rpx;
		background-image: linear-gradient(90deg,#f7a7ba,#f8bfce,#f8d0d9);
		margin:  30rpx;
		border-radius: 15rpx;
		font-weight: 700;
		font-size: 30rpx;
		color: #fff;
	}
	.switch2{
		text-align: center;
		padding:24rpx;
		margin:  30rpx;
		border-radius: 15rpx;
		color: #434343;
		font-weight: 700;
		font-size: 30rpx;
		background-color: #e2e2e2;
	}
</style>